
#ifndef BSP_H
#define BSP_H

#include <stdio.h>
#include "gd32f4xx_libopt.h"

#define SDRAM_DEVICE0_ADDR                         ((uint32_t)0xC0000000)
#define SDRAM_DEVICE1_ADDR                         ((uint32_t)0xD0000000)

#define ADC0_BLOCK_SIZE     (2048)
#define ADC0_BLOCK_NUM      (64)
#define ADC0_BUFF_SIZE      (ADC0_BLOCK_SIZE*ADC0_BLOCK_NUM)

#define DAC_WAVE_SIZE       (100)

#define LCD_X_SIZE  (480)
#define LCD_Y_SIZE  (480)

extern void bsp_sdram_init(uint32_t sdram_device);
extern void bsp_sdram_fill_buffer(uint8_t *pbuffer, uint16_t buffer_lengh, uint16_t offset);
extern void bsp_sdram_writebuffer_8(uint32_t sdram_device, uint8_t *pbuffer, uint32_t writeaddr, uint32_t numbytetowrite);
extern void bsp_sdram_readbuffer_8(uint32_t sdram_device, uint8_t *pbuffer, uint32_t readaddr, uint32_t numbytetoread);

extern void bsp_dma2_adc_transfer(uint8_t complete);
extern void bsp_tli_init(void);
extern void bsp_adc_init(void);
extern void bsp_dac_init(void);
extern void bsp_init(void);
#endif
